
package calculator;


public class Calculator {

    public double sum (int a, int b, char sign) throws DivByZero {
        double x=0;
        if (sign=='+'||sign=='-'||sign=='*'||sign=='/')
        {
            
            if (sign=='+') {
                x = (double) a + b;
            }
            if (sign=='-') {
                x = (double) a - b;
            }
            if (sign=='*') {
                x = (double) a * b;
            }
            if (sign=='/') {
                if (b==0) {
                    throw new DivByZero();
                }
                    else
                    x = (double) a / b;        
            }         
        }
        return x;
    }
   
    
}
